module.exports = [
  {
    path: '/',
    component: () => import( '../pages/login'),
    meta: {
      isPublic: true
    },
    beforeEnter: (to, from, next) => {
      // 如果有token直接进入管理页面
      if(!!localStorage.token ) {
        return next('/admin')
      }else if (!!sessionStorage.token) {
        return next('/admin')
      }else {
        next()
      }
    },
  },
  {
    path: '/admin',
    component: () => import( '../pages/index.vue'),
    // 路由前置守卫
    beforeEnter: (to, from, next) => {
      if(!!localStorage.token) {
        return next()
      }else if (!!sessionStorage.token) {
        return next()
      }else {
        return next('/')
      }
    },
    children: require('./adminCildren')
  },
  

]